package code.bigmama;

import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import my.android.util.r2.AndroidNetwork;
import android.R.string;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnKeyListener;
import android.widget.TextView;
import code.bigmama.context.ChildProfileContext;
import code.bigmama.controller.DBController;
import code.bigmama.views.*;

public class Main extends Activity
{
	public static final String DEBUG_TAG = "Main";
	
	private CameraView				mCameraView	= null;
	private VideoRecorderView	mVideoRecorder = null;
	


	@Override
	public void onCreate(Bundle savedInstanceState)
	{
//		AndroidNetwork.upload("http://bigmama.goanygate.com:8080/logging/photo/", "/sdcard", "_051.jpg");
//		AndroidNetwork.post("http://bigmama.goanygate.com:8080/accounts/register_user/");\
		

				
		Log.d(DEBUG_TAG, "OnCreate()");
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
	}
	
	@Override
	protected void onResume()
	{
		Log.d(DEBUG_TAG, "onResume()");
		super.onResume();
	}
	
	@Override
	protected void onStart()
	{
		Log.d(DEBUG_TAG, "onStart()");
		super.onStart();
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event)
	{
		switch (keyCode)
		{
			case KeyEvent.KEYCODE_BACK:
			{
//				setContentView(mTextView);
				break;
			}
			case KeyEvent.KEYCODE_FOCUS:
			{
				mCameraView.autofocus();
				break;
			}
			case KeyEvent.KEYCODE_CAMERA:
			{
				mCameraView.takePicture();
				break;
			}
		}

		return super.onKeyDown(keyCode, event);
	}

	@Override
	public boolean onKeyUp(int keyCode, KeyEvent event)
	{
		switch (keyCode)
		{
			case KeyEvent.KEYCODE_FOCUS:
			{
				mCameraView.resetAutoFocus();
			}
		}
		return super.onKeyUp(keyCode, event);
	}
	
	
}